home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
PRG
/
Speech Demo.sit
/
Speech Demo.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-11
|
2KB
|
67 lines
/* Quick & dirty example of using the new Speech Manager */
/* Created August 11, 1993 by Alan Coopersmith */
/* (Internet: alanc@soda.berkeley.edu) */
/* (US Mail: 2097 Eastwood Blvd., Ogden, UT 84403 */
/* */
/* Since this isn't really worth copyrighting I hereby release this */
/* source code into the public domain. Enjoy! */
/* */
/* Known bugs: */
/* - doesn't bother checking if the speech manager is installed */
/* - never checks if the Speech functions return errors */
/* */
/* This was developed using Symantec's Think C 5.04 */
/* <Speech.h> is available for anonymous ftp from ftp.apple.com in */
/* the directory dts/mac/sys.soft/speech as part of the Speech Manager */
#include <Speech.h>
#include <ToolUtils.h> /* GetString() */
#include <OSUtils.h> /* Delay() */
#include <Memory.h> /* HLockHi() */
#define DEFAULT_TEXT "Testing. 1. 2. 3."
#define DEFAULT_TEXT_LEN 17
main()
{
short voiceCount;
short counter;
SpeechChannel theChannel;
VoiceSpec theVoice;
char defaultText[] = DEFAULT_TEXT;
char *theTextToBeSpoken;
long textlen;
long delayLen;
OSErr myErr;
StringHandle theHand;
theHand = GetString(128);
if (theHand == nil)
{
theTextToBeSpoken = defaultText;
textlen = DEFAULT_TEXT_LEN;
}
else
{
HLockHi ((Handle) theHand);
theTextToBeSpoken = (char *) (*theHand) + 1;
textlen = (long) **theHand;
}
myErr = CountVoices (&voiceCount);
for (counter = 1; counter <= voiceCount; counter++)
{
myErr = GetIndVoice (counter, &theVoice);
myErr = NewSpeechChannel (&theVoice, &theChannel);
myErr = SpeakText (theChannel, (Ptr) theTextToBeSpoken, textlen);
while (SpeechBusy())
Delay(60, &delayLen);
myErr = DisposeSpeechChannel (theChannel);
}
}